package cn.doitedu.rdd_ds

import cn.doitedu.beans.JavaStudent
import cn.doitedu.util.SparkUtil
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.{Dataset, Encoders}

/**
 * @Date 22.4.12
 * @Created by HANGGE
 * @Description
 */
object C03_Map_2_DataSet {
  def main(args: Array[String]): Unit = {

    val session = SparkUtil.getSession
    val  ls = List(
      Map[String,String]("id"->"uid001" , "name"->"zeze") ,
      Map[String,String]("id"->"uid002" , "name"->"yuhan")
    )
    val sc = session.sparkContext
    val rdd: RDD[Map[String, String]] = sc.parallelize(ls)

    import  session.implicits._
    val ds = rdd.toDS()

    ds.printSchema()
    ds.show()
  }
}
